//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "tools\fn_playMove.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_unit","_move"];
DEFAULT_PARAM(_unit,0,objNull);
DEFAULT_PARAM(_move,1,"");

if (!isnil "_unit" && {typename _unit == typename objNull} && {!isnull _unit} && {!isnil "_move"}) then {
	if (IS_STRING(_move)) then {
		_unit playMoveNow _move;
	};
	if (IS_ARRAY(_move)) then {
		private ["_current"];
		{
			_current = animationState _unit;
			_unit playMoveNow _x;
			waituntil { animationState _unit == _x || !alive _unit };
			waituntil { animationState _unit != _x || !alive _unit };
		}foreach _move;
	};
};

TRACE("End");
TMFPROFILERSTOP;
